﻿using Unity.Mathematics;
using UnityEngine;

namespace Gj
{
    public class OverlayText : MonoBehaviour
    {
        public OverlayItem item;
        public string type;

        public void Play(string t = "")
        {
            OnPlay(t);
        }

        public void Play(int value)
        {
            if (item.show)
                OnPlay((math.abs(value)).ToString());
            else
                Close();
        }

        public void Play(int[] values)
        {
            for (var i = 0; i < values.Length; i++) Play(values[i]);
        }

        protected virtual void OnPlay(string t)
        {
        }

        protected void Close()
        {
            OverlayService.single.ReturnOverlayText(this);
        }
    }
}